singleProportionTestDialog <- function(){
	initializeDialog(title=gettext("One Proportion Test", domain="R-RcmdrPlugin.TeachingExtras"))
	onOK <- function(){
		freq <- tclvalue(freqVariable)
		n <- tclvalue(sizeVariable)
		alternative <- as.character(tclvalue(alternativeVariable))
		level <- tclvalue(confidenceLevel)
		test <- as.character(tclvalue(testVariable))
		p <- tclvalue(pVariable)
		closeDialog()
		if (test == "normal") doItAndPrint(paste("prop.test(", freq,", ", n, ", alternative='", alternative, "', p=", p, ", conf.level=", level, ", correct=FALSE)", sep=""))
		else if (test == "corrected") doItAndPrint(paste("prop.test(", freq,", ",n , ", alternative='", alternative, "', p=", p, ", conf.level=", level, ", correct=TRUE)", sep=""))
		else doItAndPrint(paste("prop.test(", freq,", ",n , ", alternative='", alternative, "', p=", p, ", conf.level=", level, ")", sep=""))
		tkfocus(CommanderWindow())
	}
	OKCancelHelp(helpSubject="prop.test")
	freqFrame <- tkframe(top)
	freqVariable <- tclVar("")
	freqField <- ttkentry(freqFrame, width="6", textvariable=freqVariable)
	sizeVariable <- tclVar("")
	sizeField <- ttkentry(freqFrame, width="6", textvariable=sizeVariable)
	radioButtons(top, name="alternative", buttons=c("twosided", "less", "greater"), values=c("two.sided", "less", "greater"),
			labels=gettextRcmdr(c("Population proportion != p0", "Population proportion < p0", "Population proportion > p0")), title=gettextRcmdr("Alternative Hypothesis"))
	radioButtons(name="test", buttons=c("normal", "corrected", "exact"), labels=gettextRcmdr(c("Normal approximation", "Normal approximation with\ncontinuity correction", "Exact binomial")), 
			title=gettextRcmdr("Type of Test"))
	rightFrame <- tkframe(top)
	confidenceFrame <- tkframe(rightFrame)
	confidenceLevel <- tclVar(".95")
	confidenceField <- ttkentry(confidenceFrame, width="6", textvariable=confidenceLevel)
	pFrame <- tkframe(rightFrame)
	pVariable <- tclVar(".5")
	pField <- ttkentry(pFrame, width="6", textvariable=pVariable)
	tkgrid(labelRcmdr(freqFrame, text=gettext("Sample frequency: ", domain="R-RcmdrPlugin.TeachingExtras"), fg="blue"), freqField, sticky="w")
	tkgrid(labelRcmdr(freqFrame, text=gettext("Sample size: ", domain="R-RcmdrPlugin.TeachingExtras"), fg="blue"), sizeField, sticky="w")
	tkgrid(freqFrame, sticky="nw")    
	tkgrid(labelRcmdr(pFrame, text=gettextRcmdr("Null hypothesis: p = "), fg="blue"), pField, sticky="w")
	tkgrid(pFrame, sticky="w")
	tkgrid(labelRcmdr(rightFrame, text=""))
	tkgrid(labelRcmdr(confidenceFrame, text=gettextRcmdr("Confidence Level: "), fg="blue"), confidenceField, sticky="w")
	tkgrid(confidenceFrame, sticky="w")
	tkgrid(alternativeFrame, rightFrame, sticky="nw")
	tkgrid(testFrame, sticky="w")
	tkgrid(buttonsFrame, columnspan=2, sticky="w")
	tkgrid.configure(confidenceField, sticky="e")
	dialogSuffix(rows=4, columns=2)
}